<#assign contextPath=springMacroRequestContext.getContextPath() />
<#import "/public/frame/main.html" as frame />
<@frame.head "南航明珠商城-商品列表">
</@frame.head>
<link rel="stylesheet" type="text/css" href="${contextPath}/resources/css/search_table.css" />
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 后台管理中心 <span class="c-gray en">&gt;</span>订单管理 <span class="c-gray en">&gt;</span> 订单处理  <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
<form method="post" name="query_order_form"  id="query_order" action="${contextPath}/tbOrder/query_tbOrderPage" >    
   <input type="hidden" name="page" value="${pagination.pageNo}"  id="page" />                        
    <div class="text-c">
        <table class="table search_table">
            <tr>
            <td colspan="6" align="left">
            <input class="btn btn-success radius" type="button"  onclick="searchs(2);"  value="待发货订单" />
           <input class="btn btn-success radius" type="button"  onclick="searchs(3);" value="信息不正确订单" />
           <input class="btn btn-success radius" type="button"  onclick="searchs(4);"   value="挂起订单" />       
            <hr color="green">
            </td>
            </tr>
           <tr>  
           <td>订单编号：</td>
           <td>
           <input type="text" class="input-text  radius"  placeholder="订单编号" id="orderNo" name="orderNo" value="${(orderQo.orderNo?c)!}" >
           </td>
            <td>会员卡号：</td>
           <td>
                   <input type="text" class="input-text  radius"  placeholder="会员卡号" id="memberNo" name="memberNo" value="${orderQo.memberNo}" >
           </td>
           <td>商品名称：</td>
           <td>
                   <input type="text" class="input-text  radius"  placeholder="商品名称" id="prodName" name="prodName" value="${orderQo.prodName}" >
           </td>
          </tr>
             
        <tr>
           <td>下单时间： </td>
           <td> 
               
              <input     onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'endDate\')||\'%y-%M-%d\'}',readOnly: true })" 
                      id="startDate" name="startTime" value="<#if orderQo.startTime?? >${orderQo.startTime?date}</#if>" 
                       class="input-text Wdate" style="width:45%;" type="text">
                                                至
               <input onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'startDate\')}',maxDate:'%y-%M-%d',readOnly: true })"
                           id="endDate"   name="endTime" value="<#if orderQo.endTime?? >${orderQo.endTime?date}</#if>" 
                           class="input-text Wdate" style="width:45%;" type="text">
           </td>
           
                 <td>收货人：</td>
           <td>
                   <input type="text" class="input-text  radius"  placeholder="收货人" id="recName" name="recName" value="${orderQo.recName}" >
           </td>
            <td> 手机号：</td>
           <td>
                   <input type="text" class="input-text  radius" placeholder="手机号" id="xn_phone" name="xn_phone" value="${orderQo.xn_phone}" >
           </td>
         </tr>
         <tr>
         
             
         <td  >商品类型：</td>
           <td>                                
           <span class="select-box radius">            
            <select  class="select" name="prodType" id="prodType">
            <option value="">全部</option>
             <option <#if orderQo.prodType==1 > selected="selected" </#if>  value="1">实物商品</option>
            <option <#if orderQo.prodType==2 > selected="selected" </#if>  value="2">虚拟商品</option>
            <option <#if orderQo.prodType==3 > selected="selected" </#if>  value="3">机票优惠券</option>
            </select>
            </span>
         </td>
          </td>
                <td>订单状态：</td>
               <td>
              <span class="select-box radius">
                   <select  class="select" widht="140px" name="state" id="state" >
                <option value="" >全部</option>
                <option <#if orderQo.state==1 > selected="selected" </#if> value="1" >未支付</option>
                <option <#if orderQo.state==2 > selected="selected" </#if> value="2" >已支付</option>
                <option <#if orderQo.state==3 > selected="selected" </#if> value="3" >信息不正确</option>
                <option <#if orderQo.state==4 > selected="selected" </#if> value="4" >挂起</option>
                <option <#if orderQo.state==5 > selected="selected" </#if> value="5" >发货</option>
                <option <#if orderQo.state==6 > selected="selected" </#if> value="6" >已发货</option>
                <option <#if orderQo.state==7 > selected="selected" </#if> value="7" >订单已取消</option>
                <option <#if orderQo.state==8 > selected="selected" </#if> value="8" >已签收</option>
                <option <#if orderQo.state==9 > selected="selected" </#if> value="9" >已退款</option>
                <option <#if orderQo.state==10 > selected="selected" </#if> value="10" >已拒签</option>
                <option <#if orderQo.state==11 > selected="selected" </#if> value="11" >支付处理中</option>
                <option <#if orderQo.state==12 > selected="selected" </#if> value="12" >支付失败</option>
                <option <#if orderQo.state==13 > selected="selected" </#if> value="13" >发放成功</option>
                <option <#if orderQo.state==14 > selected="selected" </#if> value="14" >发放中</option>    
               </select>
            </span>
           </td>
         </tr>
    
         <tr><td colspan="6" style="text-align:center;" >
           <input class="btn btn-success radius" type="button"  onclick="search();"  value="搜索" />
           <input class="btn btn-success radius" type="button"  onclick="toIsEmpty();" value="重置" />
           <input class="btn btn-success radius" type="button"  onclick="refresh();"   value="刷新" />
             </td>
         </tr>
      </table>
    </div>
</form>
 
    <div class="cl pd-5 bg-1 bk-gray mt-20"> 
  
    
    <span class="r">共有数据：<strong> ${pagination.totalCount} </strong> 条</span> </div>
    <table class="table table-border table-bordered table-bg">
        <thead>
        
        <tr class="text-c">
            <!-- <th width="45px">
            <input  type="checkbox" id="selectAll" disabled="disabled" onclick="checkAll()"/>
            </th> -->
            <th width="120">订单编号</th>
            <th width="150">商品名称</th>
            <th width="80">商品类型</th>
            <th width="70">数量</th>
            <th width="120">下单时间</th>
            <th width="150">收货人/手机号</th>
            <th width="50">状态</th>
            <th width="50">操作</th>
    
        </tr>
        </thead>
        <tbody>
       <#if pagination.list?? && (pagination.list?size &gt; 0) >
        <#list pagination.list as orders> 
             <tr>
                   <td >${orders.id?c}  </td>
                   <td > 
                   <#if fieldMap??>
                      <#list fieldMap?keys as key> 
                       <#if orders.id?c==key >
                          <#list fieldMap[key]  as ps>  
                              ${ ps.field_two}&nbsp;
                          </#list>
                     </#if>      
                 </#list>
                   </#if>
                       
                      </td>
                   <td >  
                    <#if orders.orderType==1 >实物商品 
                      <#elseif orders.orderType==2  >  虚拟商品
                    <#elseif orders.orderType==3  >  机票优惠券
                     </#if>  
               </td>
                  <td>   ${orders.orderPayInfo.orderNum }  </td>
                 <td>   ${orders.orderTime?datetime }  </td>
                 
                 <td>     
                     <#if orders.xn_phone==null> ${orders.receiveInfo.recName }
                      <#else> ${orders.xn_phone}
                     </#if>
                </td>
                
                 <td>
                    <#if orders.state==1 >未支付
                    <#elseif orders.state==2  > 已支付
                     <#elseif orders.state==3  > 信息不正确
                       <#elseif orders.state==4  > 挂起
                    <#elseif orders.state==5  >    发货
                     <#elseif orders.state==6  > 已发货
                    <#elseif orders.state==7  > 订单已取消
                       <#elseif orders.state==8  > 已签收
                    <#elseif orders.state==9  > 已退款
                    <#elseif orders.state==10  >已拒签
                    <#elseif orders.state==11  > 支付处理中
                    <#elseif orders.state==12  > 支付失败
                    <#elseif orders.state==13  > 发放成功
                    <#elseif orders.state==14  > 发放中
                     </#if>  
                     
                 </td>
                  <td>
                  <#if orders.state==1 ><a style="color:blue;" class="member_siteinfo" href="#" onclick="getTb2('${orders.id?c}')">取消订单</a>
                  <#elseif orders.state==2  > 
                          <#if orders.xn_state==1 > 已发货
                          <#else><a style="color:blue;" href="javascript:showOrderOperation('${orders.id?c}')">操作</a>
                          </#if>
                          
                          <#if orders.orderType=="2" ><a style="color:blue;" class="edit_delivery" href="#" "  onclick="reSend('${orders.id?c}')">重发短信</a>
                          
                          </#if>
                   
                 <#elseif orders.state==3  > 
                         <a style="color:blue;"   href="#" onclick="orderVerify('${orders.id?c}')">审核</a>    
                         </br><a style="color:blue;" class="member_siteinfo" href="javascript:showOrderSendAddress('${orders.id?c}')" >修改</a>
                 </#if>
                <#if orders.state==4  >     <a style="color:blue;" class="member_siteinfo" href="#" onclick="showOrderDescMsg('${orders.id?c}')">备注</a></#if>
                  <#if orders.state==6  >    <#if orders.orderType=="1"  >    <a style="color:blue;" class="edit_delivery" href="#" onclick="getTb4('${orders_index}')">物流</a> </#if>     </#if>
                  <#if orders.state==11  > <a style="color:blue;" class="edit_delivery" href="#" onclick="checkOrderPaymentType('${orders.id?c}')">查询支付结果</a>    </#if>
                  <#if orders.state==13  >     <#if orders.xn_state==1  >            已发货<#else><a style="color:blue;" href="javascript:showOrderOperation('${orders.id?c}')">操作</a>    </#if><a style="color:blue;" class="edit_delivery" href="#" " onclick="reSend('${orders.id?c}')" >重发短信</a>    </#if>
                  </td>
             </tr>
             <input type="hidden" value='${orders.delivery}' id="content${orders_index}">
      </#list></#if>
     </tbody>
    </table>
    <div id="biuuu_city" style="padding-top: 10px;float: right"></div>
</div>
<@frame.end "default">
</@frame.end>
 
<script type="text/javascript" src="${contextPath}/resources/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/laypage/laypage.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/order/search_order_server_list.js"></script>
<script type="text/javascript">
var path="${contextPath}";
laypage({
    cont: 'biuuu_city',//容器。值支持id名、原生dom对象，jquery对象。
    pages: ${pagination.totalPage},//通过后台拿到的总页数
    curr:  ${pagination.pageNo} || 1, //当前页
    skip: true, //是否开启跳页
	first: 1, //将首页显示为数字1,。若不显示，设置false即可
	last: ${pagination.totalPage}, //将尾页显示为总页数。若不显示，设置false即可
    jump: function(obj , first){//触发分页后的回调
        if(!first){ //点击跳页触发函数;当前页为obj.curr
          $(page).val(obj.curr);//获取点击的页码
          $(query_order_form).submit();
        }
    }
})  
 
 		//物流信息
		function getTb4(id){
			var text= $("#content"+id).val();
			//var jsonreturnMsg= $("#returnParamJson"+id).val();
				layer.open({
		 		  title: '物流信息',
		 		  maxWidth:400,
		 		  maxHeight:400,
		 		  content:   text 
		 		});    
		}
//取消订单
function getTb2(id){ 
	if(confirm("确定要取消该订单吗?")){
		$.ajax({
			url : path + "/tbOrder/update_order_state",
			cache : false,
			type : 'post',
			dataType : 'text',
			data : {
				"id" : id,
				"state" :7,
				"remark" : ""
			},
			success : function(msg) {
				layer.msg('操作成功!',{icon:1,time:1000},function(){

					window.location.href = window.location.href;
				});
			 
			},
			error : function() {
				layer.msg('操作失败!',{icon:1,time:1000},function(){
				});
				
			}
		});	

	}
}

 
</script>